package gui;

import org.newdawn.slick.Font;
import org.newdawn.slick.Graphics;

public class GUIEvent {

	protected float x;
	protected float y;
	private int startAt;
	
	public GUIEvent(float x,float y,int s){
		this.x = x;
		this.y = y;
		this.setStartAt(s);
	}
	
	public void render(Graphics g){
		
	}
	
	public void setString(String message){
		
	}
	
	public boolean readyToDisplay(){
		return startAt == 0;
	}
	
	public void update(int delta){
		if(startAt != 0){
			startAt -= delta;
		}
	}

	public void setStartAt(int startAt) {
		this.startAt = startAt;
	}

	public int getStartAt() {
		return startAt;
	}
	
    protected int getTextWidth (String text, Font font)
    {
        int width = 0;

        for (char ch : text.toCharArray())
            if (ch == ' ')
                width += 2;
            else
                width += font.getWidth(String.valueOf(ch));

        return width;
    }
}
